cmake_minimum_required(VERSION 2.8)
cmake_policy(VERSION 2.8)
PROJECT(Frink CXX)

SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeScripts)
INCLUDE(ConfigDependencies)

# Set Compiler Flags
SET(CXX_WARNINGS_FLAGS "-Wall -Wformat -Wformat-security -W -Wpointer-arith -Wcast-align -Wsign-compare -Woverloaded-virtual")
#SET(CXX_WARNINGS_FLAGS "${CXX_WARNINGS_FLAGS} -Werror")
# set the general CXX flags, note that subproject folders may add to this list for themselves
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 ${CXX_WARNINGS_FLAGS}")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")

# the required C++11 flag depends on the compiler brand:
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")  # force colored output through make/ninja
    SET(CPP11_FLAG "-std=c++11")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
    SET(CPP11_FLAG "-std=gnu++0x")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
    SET(CPP11_FLAG "-std=c++11")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
  # using Visual Studio C++
endif()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CPP11_FLAG}")

OPTION(COMPILE_WITH_PROFILER
  "Build Frink with profiling enabled"
  OFF)
if (COMPILE_WITH_PROFILER)
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
  SET (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -pg")
endif()

SET(CMAKE_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}")

SET(CMAKE_INSTALL_PREFIX ".")  # install by default in the build dir

ADD_SUBDIRECTORY (src)
 
